<?php
class Offline extends Vfriend_Db {	
	var $cache;
	var $clear;
	public function __construct() {
		$this->cache 		= new Vfriend_Cache();
		$this->clear 		= $this->cache->clear;
	}	
	public function get($intOfflineId) {
		try {
			$arrResult	= null;
			$strKey 	= OFFLINE_GET . $intOfflineId;
			$arrResult 	= $this->cache->get($strKey);
			if(!Vfriend_Function::isCached($arrResult)) {
				$this->prepare('call offlines_get(?)');
				$this->bindParam(1, $intOfflineId, PDO::PARAM_INT, 11);											
				$arrResult 	= $this->fetchAll();	
				$this->cache->set($strKey, $arrResult, OFFLINE_GET_EXPIRE);
			}						
			return isset($arrResult[0]) ? $arrResult[0] : null;
		} catch(Exception $e) {
			Vfriend_Function::logDb('Backend::Offline::get - ' .$e->getMessage());			
			return null;
		}
	}
}
?>